Configure Log Tracking Settings for a UFT One Test
Source code
'************************************************************************************************************************
' Description:
'
' This example uses the LogTrackingSettings object to enable UFT One to
' configure your application's logging framework and receive log messages
' that may be generated.
'
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable

' Open UFT One, prepare objects variables, and open a test

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start UFT One
qtApp.Visible = True ' Make the UFT One application visible
qtApp.Open "C:\Program Files (x86)\OpenText\UFT One\Tests\Test11" 'Open the test. The path may vary depending on UFT One versions.
Set qtLogTrackingSettings = qtApp.Test.Settings.LogTracking ' Return LogTrackingSettings object for the current test

'Configure the LogTrackingSettings for the test
'(Before you do this, make sure that your application is ready and able to invoke logging requests)
With qtLogTrackingSettings

    ' Activate LogTracking functionality - When the test runs, UFT One will be able to receive log messages
    ' from the log framework used by your application and include these messages in the run results
    .IncludeInResults = True

    ' Configure UFT One
    .MinTriggerLevel = "ERROR" ' Instructs UFT One to add a node to the run results for every log message with a severity level of "ERROR" or higher
    .IP = "127.0.0.1" 'The IP address of the source from which UFT One receives log framework messages
    .Port = "18081" 'The port that UFT One listens to on the computer on which the log framework runs

    ' Configure log framework
    .EnableAutoConfig = True ' Enables UFT One to configure the log framework
    .ConfigFile = "C:\My_Test_Suite\My_AUT\MyApplication.exe.log4net" ' The log configuration file to modify when the run begins
    .MinConfigLevel = "WARN" ' Set the verbosity level (log message severity level)to "WARN" so that messages with a severity of "WARN" and higher are logged
    ' Note: A large quantity of log messages may affect performance
    .RecoverConfigAfterRun = False ' After the run session, instructs UFT One not to restore the log configuration file that existed prior to the beginning of this run

End With

qtApp.Test.Save ' Save modified test
qtApp.Test.Close ' Close test

Set qtLogTrackingSettings = Nothing ' Release the LogTrackingSettings object

Set qtApp = Nothing ' Release the Application object